<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/common/pages/common.jsp" %>
<%@ include file="/common/pages/taglibs.jsp" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="ex" uri="/ex"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=basePath%>/common/js/jquery-ui/themes/smoothness/jquery-ui.css">
<script type="text/javascript" src="<%=basePath%>/common/js/jquery-ui/jquery.ui.js"></script>
<script type="text/javascript" src="<%=basePath%>iccard/merchant/js/merchant_add.js"></script>
<title>merchant add</title>
</head>
<body>
	<input value="<%=basePath%>" id="contextPath" type="hidden"/>
	<form id="merchant_form" method="post"
	action="<%=basePath%>iccard/combocard/${nextaction}"
	onsubmit="">
	<script type="text/javascript" >
		<c:if test="${nextaction eq 'add'}">
			opFlag = 0;
		</c:if>
		<c:if test="${nextaction eq 'update'}">
			opFlag = 1;
		</c:if>
	</script>
	<input type="hidden" id="merchantId" name="merchantId" value="${merchant.merchantId}" />
	<input value="${merchant.merchantName}" id="oldcheckMerchantName" type="hidden"/>
	<input value="${merchant.merchantEncode}" id="oldMerchantEncode" type="hidden"/>
	<div id="merchantset" class="easyui-panel" nofit=true
		style="padding: 2px; border: 1px solid #ddd;" title="${formtitle}商家"
		data-options="iconCls:'icon-bt',collapsible:true">
		<table width="90%">
			<tr>
				<td>商户名称：</td>
				<td><input class="easyui-validatebox" validType="checkMerchantName" data-options="required:true" name="merchantName" id="merchantName"
					value="<c:out value="${merchant.merchantName}"/>" style="width: 500px" maxlength="32" ${param.readonly}/> <font color="red">*</font>
				</td>
			</tr>
			<tr>
				<td>商户地址：</td>
				<td><input class="easyui-validatebox" validType="checkMinLength[2]" 
					data-options="required:true" name="merchantAddr" id="merchantAddr"
					value="<c:out value="${merchant.merchantAddr}"/>" style="width: 500px" maxlength="32" ${param.readonly}/> <font color="red">*</font>
				</td>
			</tr>
			<tr>
				<td>商户编码：</td>
				<td><input class="easyui-validatebox" validType="checkMerchantEncode[15]"
					data-options="required:true" name="merchantEncode" id="merchantEncode"
					value="<c:out value="${merchant.merchantEncode}"/>" onKeyUp="getMerchantcode();" style="width: 200px" maxlength="15" ${param.readonly}/> <font color="red">*</font>
				</td>
				
				<td>商户编号：</td>
				<td><input class="easyui-validatebox" validType="checkMerchantCode[5]" data-options="required:true" name="merchantCode" id="merchantCode"
					value="<c:out value="${merchant.merchantCode}"/>" style="width: 200px" maxlength="5" readonly="readonly"/> <font color="red">*</font>
				</td>

			</tr>
			<tr>
				<td>开户名：</td>
				<td><input class="easyui-validatebox" validType="checkMinLength[2]" 
					data-options="required:true" name="accountName" id="accountName"
					value="<c:out value="${merchant.accountName}"/>" style="width: 200px" maxlength="10" ${param.readonly}/> <font color="red">*</font>
				</td>
				
				<td>开户账号：</td>
				<td><input class="easyui-validatebox" validType="checkAccountCode[19]" data-options="required:true" name="accountCode" id="accountCode"
					value="<c:out value="${merchant.accountCode}"/>" style="width: 200px" maxlength="19" ${param.readonly}/> <font color="red">*</font>
				</td>

			</tr>
			<tr>
				<td>开户行：</td>
				<td><input class="easyui-validatebox" validType="checkMinLength[2]" data-options="required:true" name="bank" id="bank"
					value="<c:out value="${merchant.bank}"/>" style="width: 200px" maxlength="32" ${param.readonly}/> <font color="red">*</font>
				</td>
				
				<td>责任人：</td>
				<td><input class="easyui-validatebox" validType="checkMinLength[2]"  data-options="required:true" name="corporation" id="corporation"
					value="<c:out value="${merchant.corporation}"/>" style="width: 200px" maxlength="10" ${param.readonly}/> <font color="red">*</font>
				</td>

			</tr>
			
			<tr>
				<td>充值卡结算折扣：</td>
				<td><input class="easyui-numberbox" validType="checkRechargeableCardDiscountRate[2]" data-options="required:true" name="rechargeableCardDiscountRate" id="rechargeableCardDiscountRate"
					value="<c:out value="${merchant.rechargeableCardDiscountRate}"/>" style="width: 200px" maxlength="2" ${param.readonly}/>折（请填写1~99整数） <font color="red">*</font>
				</td>
				
				<td>联系电话：</td>
				<td><input class="easyui-validatebox" validType="checkTelephone[11]" data-options="required:true" name="telphone" id="telphone"
					value="<c:out value="${merchant.telphone}"/>" style="width: 200px" maxlength="11" ${param.readonly}/> <font color="red">*</font>
				</td>

			</tr>
			<tr>
				<td>适用转账模板：</td>
				<td>
					<input type="hidden" id="accountTemplateTemp" name="accountTemplateTemp" value="${merchant.accountTemplate}" />
					<select id="accountTemplate" name="accountTemplate" onchange="mobuanChange();" >
						<option value="0">公对私模板</option>   
					    <option value="1">公对公模板</option>   
					</select>
				</td>
				<td>转账摘要：</td>
				<td>
					<input type="hidden" id="accountDigestTemp" name="accountDigestTemp" value="${merchant.accountDigest}" />
					<select id="accountDigest" name="accountDigest" >
						<option value="0">划款</option>   
					    <option value="1">来往款</option>   
					</select> 
				</td>
				
			</tr>
			<tr>
				<td id="moshiID" style="display:none">模式：</td>
				<td id="moshiID_select" style="display:none">
					<input type="hidden" id="accountModelTemp" name="accountModelTemp" value="${merchant.accountModel}" />
					<select id="accountModel" name="accountModel" >
						<option value="1">行内公对公业务</option>   
					    <option value="0">其他</option>   
					</select>
				</td>

			</tr>
			
			<tr>
				<td>商家业务类型：</td>
				<td>
					<input type="hidden" id="merchantType" name="merchantType" value="${merchant.merchantType}" />
					<input name="shoseactions" type="radio" value="0"  class="" onclick="checkAction(this,'')" bchecked=""/>餐饮
					<input name="shoseactions" type="radio" value="1"  class="" onclick="checkAction(this,'')" bchecked=""/>住宿
					<input name="shoseactions" type="radio" value="2"  class="" onclick="checkAction(this,'')" bchecked=""/>食品
					<input name="shoseactions" type="radio" value="3"  class="" onclick="checkAction(this,'')" bchecked=""/>服装
					<input name="shoseactions" type="radio" value="4"  class="" onclick="checkAction(this,'')" bchecked=""/>纪念品
					<input name="shoseactions" type="radio" value="5"  class="" onclick="checkAction(this,'')" bchecked=""/>酒吧
					<input name="shoseactions" type="radio" value="6"  class="" onclick="checkAction(this,'')" bchecked=""/>咖啡店
					<input name="shoseactions" type="radio" value="7"  class="" onclick="checkAction(this,'')" bchecked=""/>茶楼
					<input name="shoseactions" type="radio" value="8"  class="" onclick="checkAction(this,'')" bchecked=""/>其他
				</td>
			</tr>
		</table>

	<div id="nrqx" class="easyui-panel" nofit=true
		data-options="title:'pos机S/N码',iconCls:'icon-bt',collapsible:true,tools:'#tt'">
		<div id="merctDiv" >
		
		<c:if test="${nextaction eq 'add'}">
			<div class="easyui-panel">
				<table width="90%">
					<tr>
						<td>POS机编码<strong id="pp">1</strong>：</td>
						<td><input class="easyui-validatebox" validType="checkPosCode[8]"
							data-options="required:true" name="poslists[0].posCode" id="poslists[0].posCode" 
							value="" style="width: 250px" maxlength="8" /> <font color="red">*</font>
						</td>
						<td align="right" colspan=3><a id="delm" href="#" class="easyui-linkbutton" onclick="javascript:delm(this);">删除POS机</a></td>
					</tr>
					
				</table>
			</div>
		</c:if>	
		
		<c:if test="${nextaction eq 'update'}">
			<c:forEach items="${merchant.poslists}" var="list"  varStatus="status"> 
				<div class="easyui-panel">
					<table width="90%">
						<tr>
							<td>POS机编码<strong id="pp">${status.index+1}</strong>：</td>
							<td><input class="easyui-validatebox" validType="checkPosCode[8]"
								data-options="required:true" name="poslists[${status.index}].posCode" id="poslists[${status.index}].posCode" 
								value="${list.posCode}" style="width: 250px" maxlength="8" />
								<input value="${list.posId}" id="poslists[${status.index}].posId" type="hidden"/>
							</td>
							<td align="right" colspan=3><a id="delm" href="#" class="easyui-linkbutton" onclick="javascript:delm(this);">删除POS机</a></td>
						</tr>
						
					</table>
				</div>
			</c:forEach>
		</c:if>		
			
		</div>
		<div>
			<div style="padding: 10px 0 10px 10px"><a href="#" class="easyui-linkbutton" onclick="addm();">继续添加绑定POS机</a></div>
		</div>
	</div>

	</div>

</form>
<c:set var="showdiv" value="" />
<c:if test="${not empty param.readonly}">
	<c:set var="showdiv" value="none" />
</c:if>
<div id="btn_div"
	style="display: block;text-align:center;margin-top:10px">
	<c:if test="${nextaction eq 'update'}">
			<a id="saveb" href="#" class="easyui-linkbutton" onclick="saveMerchant();">保存</a>
			<a href="#" class="easyui-linkbutton" onclick="back()">取消</a>
			<!--<a href="#" class="easyui-linkbutton" onclick="clearForm()">清除</a> -->
	</c:if>
	<c:if test="${nextaction eq 'add'}">
			<a id="saveb" href="#" class="easyui-linkbutton" onclick="saveMerchant();">保存</a>
			<a href="#" class="easyui-linkbutton" onclick="back()">取消</a>
			<!-- <a href="#" class="easyui-linkbutton" onclick="clearForm()">清除</a> -->
	</c:if>
</div>
</body>
</html>